const arr1 = [
  {
    name: "banner",
    children: [
      {
        name: "banner-add",
      },
      {
        name: "banner-list",
      },
    ],
  },
];

function getName(route) {
  let str = "";
  if (route.children) {
    str = getName(route.children[0]);
  } else {
    str = route.name;
  }

  return str;
}

const str = getName(arr1[0]);
console.log(str);
